<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Stream Template Resources</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="resources.html" title="Chapter 16. Resources">
<link rel="prev" href="resources.string.html" title="String Template Resources">
<link rel="next" href="resources.extends.html" title="Extends Template Resources">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Stream Template Resources</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="resources.string.html">Prev</a> </td>
<th width="60%" align="center">Chapter 16. Resources</th>
<td width="20%" align="right"> <a accesskey="n" href="resources.extends.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Stream Template Resources">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="resources.streams"></a>Stream Template Resources</h2></div></div></div>
<p>
   Streams allow you to use PHP streams as a template resource.
   The syntax is much the same a traditional template resource names.
  </p>
<p>
    Smarty will first look for a registered template resource. If nothing is found, it will check if a PHP stream is available.
    If a stream is available, Smarty will use it to fetch the template.
    </p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>You can further define allowed streams with security enabled.</p>
</div>
<p>
  </p>
<div class="example">
<a name="id455655"></a><p class="title"><b>Example 16.7. Stream from PHP</b></p>
<div class="example-contents">
<p>Using a PHP stream for a template resource from the display() function.</p>
<pre class="programlisting">
 
 $smarty-&gt;display('foo:bar.tpl');
 
   </pre>
</div>
</div>
<br class="example-break"><div class="example">
<a name="id455701"></a><p class="title"><b>Example 16.8. Stream from Template</b></p>
<div class="example-contents">
<p>Using a PHP stream for a template resource from within a template.</p>
<pre class="programlisting">
 
 {include file="foo:bar.tpl"}
 
   </pre>
</div>
</div>
<br class="example-break">
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="resources.string.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="resources.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="resources.extends.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">String Template Resources </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Extends Template Resources</td>
</tr>
</table>
</div>
</body>
</html>
